//
//  SVProgressHUD+ShowImage.m
//  LenovoCochat
//
//  Created by shanyue li on 2019/4/18.
//  Copyright © 2019 www.lenovo.com. All rights reserved.
//

#import "SVProgressHUD+ShowImage.h"
#import "LNProgressHUD.h"
//#import "Dialog.h"

@implementation SVProgressHUD (ShowImage)
+ (void)showImageLong:(nonnull UIImage*)image status:(nullable NSString*)status{
    [SVProgressHUD setMinimumDismissTimeInterval:MAXFLOAT];
    [SVProgressHUD showImage:image status:status];
}
+ (void)showNewImage:(SVProgressHUDNewStatus)status status:(nullable NSString*)statusStr{
    if (status == SVProgressHUDNewStatusSuccess) {
        [LNProgressHUD showNewHUDWithImage:[UIImage imageNamed:@"SCSuccess"] text:statusStr isAutoHiden:YES];
//        [SVProgressHUD showImage:[UIImage imageNamed:@"SCSuccess"] status:statusStr];
    } else if (status == SVProgressHUDNewStatusError) {
        dispatch_async(dispatch_get_main_queue(), ^{
            if ([SVProgressHUD isVisible]) {
                [SVProgressHUD dismissLong];
            }
//            [Dialog toastCenter:statusStr];
        });
//        [SVProgressHUD showImage:[UIImage imageNamed:@"SCError"] status:statusStr];
    } else if (status == SVProgressHUDNewStatusInfo) {
        [LNProgressHUD showNewHUDWithImage:[UIImage imageNamed:@"SCAlert"] text:statusStr isAutoHiden:YES];
//        [SVProgressHUD showImage:[UIImage imageNamed:@"SCAlert"] status:statusStr];
    } else if (status == SVProgressHUDNewStatusWelcome) {
        [LNProgressHUD showNewHUDWithImage:[UIImage imageNamed:@"SCWelcome"] text:statusStr isAutoHiden:YES];
//        [SVProgressHUD showImage:[UIImage imageNamed:@"SCWelcome"] status:statusStr];
    }
//    [SVProgressHUD dismissWithDelay:1];
}
+ (void)dismissLong{
    [SVProgressHUD setMinimumDismissTimeInterval:0.8];
    [SVProgressHUD dismiss];
}
+ (void)showSuccessWithStatus:(NSString*)status{
    [LNProgressHUD showStatus:LNProgressHUDStatusSuccess text:status isAutoHiden:YES];
}
+ (void)showErrorWithStatus:(NSString*)status{
    [LNProgressHUD showStatus:LNProgressHUDStatusError text:status isAutoHiden:YES];
}
+ (void)showInfoWithStatus:(NSString*)status{
    [LNProgressHUD showStatus:LNProgressHUDStatusError text:status isAutoHiden:YES];
}
+ (void)showAlertWithStatus:(NSString *_Nullable)status{
    [LNProgressHUD showStatus:LNProgressHUDStatusInfo text:status isAutoHiden:YES];
}
@end
